package com.example.fw;

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;


public class ApplicationManager {
	
	public WebDriver driver;
	public String baseUrl;
	private NavigationWorker navigationWorker;
	private GroupWorker groupWorker;
	private ContactWorker contactWorker;
	private ActionWorker actionWorker;
	
	public ApplicationManager() {
		driver = new FirefoxDriver();
		baseUrl = "http://localhost:8888/";
		driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
	}
	
	public void stop() {
		driver.quit();
	}
	
	public NavigationWorker getNavigationWorker() {
		if (navigationWorker == null) {
			navigationWorker = new NavigationWorker(this);
		}
		return navigationWorker;
	}
	
	public GroupWorker getGroupWorker() {
		if (groupWorker == null) {
			groupWorker = new GroupWorker(this);
		}
		return groupWorker;
	}
	
	public ContactWorker getContactWorker() {
		if (contactWorker == null) {
			contactWorker = new ContactWorker(this);
		}
		return contactWorker;
	}
	
	public ActionWorker getActionWorker() {
		if (actionWorker == null) {
			actionWorker = new ActionWorker(this);
		}
		return actionWorker;
	}
}
